CMAKE_MINIMUM_REQUIRED(VERSION 3.17)

IF (NOT TARGET ZXING::H)
    ADD_LIBRARY(ZXING::H INTERFACE IMPORTED)
    TARGET_INCLUDE_DIRECTORIES(ZXING::H INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/windows/include")
ENDIF ()

IF (NOT TARGET ZXING::LIB)
    FIND_LIBRARY(ZXING_LIB NAMES ZXing PATHS ${CMAKE_CURRENT_SOURCE_DIR}/windows/lib NO_DEFAULT_PATH)
    ADD_LIBRARY(ZXING::LIB STATIC IMPORTED)
    SET_TARGET_PROPERTIES(ZXING::LIB PROPERTIES IMPORTED_LOCATION "${ZXING_LIB}")
ENDIF ()

IF (NOT TARGET LIBRARIES::ZXING)
    ADD_LIBRARY(LIBRARIES::ZXING INTERFACE IMPORTED GLOBAL)
    TARGET_LINK_LIBRARIES(LIBRARIES::ZXING INTERFACE
            ZXING::H
            ZXING::LIB)
ENDIF ()